<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="description" content="">
    <meta name="author" content="rensixiang">
    <meta name="keyword" content="口袋鼠">
    <title>口袋鼠统计管理系统</title>
    <!-- Bootstrap core CSS -->
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/bootstrap-reset.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/owl.carousel.css" type="text/css">
    <!-- Custom styles for this template -->
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/font-awesome.css" rel="stylesheet">
    <link href="/css/style-responsive.css" rel="stylesheet" />
    <!-- js placed at the end of the document so the pages load faster -->
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/jquery.scrollTo.min.js"></script>
    <script src="/js/jquery.nicescroll.js" type="text/javascript"></script>
    <link href="/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <!--common script for all pages-->
    <script src="/js/common-scripts.js"></script>
    <style type="text/css">
        #main-content .list-group-item{
           /* height: 40px; */
           overflow:hidden;
        }
    </style>
</head>
<body>
<section id="container" class="">
    <!--header start-->
    <header class="header white-bg">
    <div class="sidebar-toggle-box">
        <div data-original-title="Toggle Navigation" data-placement="right" class="icon-reorder tooltips">
            <i class="fa fa-bars" ></i>
        </div>
    </div>
    <!--logo start-->
    <a href="#" class="logo">口袋鼠<span>统计系统</span></a>
    <!--logo end-->
    <div class="top-nav ">
        <!--search & user info start-->
        <ul class="nav pull-right top-menu">
            <!-- user login dropdown start-->
            <li class="dropdown">
                <a data-toggle="dropdown" class="" href="#">
                    <img alt="" src="/img/logo.png" style="width: 22px;">
                    <span class="username"><?php echo Yii::$app->cache->get('admin')['username']?></span>
                </a>
                <ul class="dropdown-menu extended logout">
                    <li><a href="/site/logout"><i class="icon-key"></i> 退 出</a><a data-toggle="modal" data-target="#myModal2">修改密码</a></li>
                </ul>

            </li>
            <!-- user login dropdown end -->
        </ul>
        <!--search & user info end-->
    </div>
</header>    <!--header end-->
<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog">
      <div class="modal-content animated bounceInRight">
          <div class="modal-header">
              <button type="button" class="close invoiceclose" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
              </button>
              <h4 class="modal-title">修改密码 </h4>
          </div>
          <div class="modal-body">
            <div class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-3 control-label">*原密码：</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="old_password" type="text"  placeholder="原密码不能为空">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">*新密码：</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="new_password" type="text"  placeholder="新密码不能为空">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">*确认密码：</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="repet_password" type="text"  placeholder="确认密码不能为空">
                    </div>
                </div>
            </div> 
          </div>
          <div class="modal-footer">
              <button type="button" class="btn btn-primary" id="edit_pass" data-dismiss="modal">确认</button>
          </div>
      </div>
  </div>
</div>
<script>
$("#edit_pass").click(function(){
    var old_password = $("#old_password").val();
    var new_password = $("#new_password").val();
    var repet_password = $("#repet_password").val();
    if(old_password.length <= 0){
        alert("原密码不能为空");
        return false;
    }
    if(new_password.length <= 0){
        alert("新密码不能为空");
        return false;
    }
    if(repet_password.length <= 0){
        alert("确认密码不能为空");
        return false;
    }
    if(repet_password != new_password){
        alert("两次密码不一致");
        return false;   
    }
    $.ajax({
        type: "post",
        url: "edit-password-ajax-do",
        data: {old_password:old_password,new_password:new_password,repet_password:repet_password},
        dataType: "json",
        success: function(param){
        if(param.code == '20000'){
            swal("修改密码成功！", param.message, "success");
            window.location.href='<?= yii\helpers\Url::to(['/site/login'])?>';
        }else{
            swal("修改密码失败！", param.message, "error")
        }
      }
    })
})
</script>
<!--sidebar start-->
<aside>
<?php $url = explode('?',$_SERVER["REQUEST_URI"])[0];?>
    <div id="sidebar"  class="nav-collapse ">
        <!-- sidebar menu start-->
        <ul class="sidebar-menu">
            <li  class="sub-menu active" >
                <a class="" href="###">
                    <i class="icon-list"></i>
                    <span>用户管理</span>                  
                </a>
                <ul class="sub">
                    <li class="<?php echo $url == '/site/list' ? 'active' :'';?>"><a class="" href="/site/list">用户列表</a></li>
                </ul>
            </li>
            <li  class="sub-menu active" >
                <a class="" href="###">
                    <i class="icon-list"></i>
                    <span>区域管理</span>                  
                </a>
                <ul class="sub">
                    <li class="<?php echo $url == '/sign/citys' ? 'active' :'';?>"><a class="" href="/sign/citys">区域级别设置</a></li>
                    <li class="<?php echo $url == '/sign/index' ? 'active' :'';?>"><a class="" href="/sign/index">区域查询列表</a></li>
                </ul>
            </li>
        </ul>
    </div>
</aside>    
<!--sidebar end-->
    <!--子页面-->
    <?php $this->beginBody() ?>

    <?= $content ?>

    <?php $this->endBody() ?>
    <!--/子页面-->
</section>
</body>
</html>
